Shopping on line can be easy, simple and save you lots of money. It can also take a lot of your time, frustrate you, and result in unwanted purchases. Now the same can be said for regular high street shopping, but with the vast opportunity presented by the Internet it will pay you to spend a few minutes reading this and understanding how to better optimize your Logo Programming Language shopping experience:

1. Compare - without doubt the biggest advantage that the Logo Programming Language offers shoppers today is the ability to compare thousands of Logo Programming Language at a time. This is a great thing, but not necessarily all the time! Too much can be daunting at times so take advantage of the great comparison sites and where possible let them do the hard work for you.

2. Research - if it has been said it will be on the internet. Ignorance is no longer a justifiable reason for buying the wrong thing. Take the time to research in detail everything that you could possible want to know about

3. Testimonials - don't know anybody that has bought a Logo Programming Language ? Wrong! If the Logo Programming Language is good the internet will let you know. Use the Internet as a friend and get testimonials before you buy.

4. Questions - Got a question about Logo Programming Language then search the Forums, FAQ's, Blogs etc. Don't be afraid to ask .....

5. Reputation - Never heard of the company selling Logo Programming Language ? Don't worry, no reason why you should know every company in the world, but you know someone that does! Use the internet to find out what people are saying about Logo Programming Language and build up a picture of their reputation for sales, returns, customer service, delivery etc.

6. Returns - still worried that even after all of the above your Logo Programming Language wont be what you want? Check out the returns policy. There is so much competition now that someone, somewhere is bound to offer the terms that you are comfortable with.

7. Feedback - happy with your Logo Programming Language then let people know, after all you are depending on others people input in your buying decision, so why not give a little back.

8. Security - check for the yellow padlock on the Logo Programming Language site before you buy, and the s after http:/ /i.e. https:// = a secure site

9. Contact - got a question about Logo Programming Language , or want to leave a comment then check out the sites contact page. Reputable companies have them and respond.

10. Payment - ready to pay for your Logo Programming Language , then use your credit card or PayPal! Be aware of companies that don't accept them, there may be genuine reasons but given the huge amount of choice you have when buying online there is no reason at all not to buy via credit card or PayPal.

{{Infobox programming language|name = Logo|logo = |paradigm = functional programming, educational programming language|year = 1967 & [Seymour Papert|implementations = [UCBLogo, many others]|influenced = Smalltalk, Etoys (programming language)-->

The Logo programming language is a functional programming computer programming programming language. It is an easier to read adaptation and dialect of the Lisp (programming language) language; some have called it Lisp without the S-expression. It was created for educational use, more so for Constructivism (learning theory) teaching, by Daniel G. Bobrow, Wally Feurzeig and Seymour Papert. Today, it is known mainly for its "turtle graphics", but it also has significant facilities for handling lists, files, and I/O. Logo can be used to teach most computer science concepts, as UC Berkeley Lecturer Brian Harvey (Lecturer) does in his "Computer Science Logo Style" trilogy.

History Logo was created in 1967 at Bolt, Beranek and Newman (BBN), a Cambridge, Massachusetts research firm, by Wally Feurzeig and Seymour Papert. Its intellectual roots are in artificial intelligence, mathematical logic and developmental psychology. The first four years of Logo research, development and teaching work was done at BBN. The first implementation of Logo, called "ghost", was written in LISP on an SDS 950. The goal was to create a "mathland" where kids could play with words and sentences. Modeled on LISP, the design goals of Logo included accessible power and informative error messages. The use of virtual Turtles (robot) allowed for immediate visual feedback and debugging.The first working turtle was created at MIT in 1969. A display turtle preceded the physical floor turtle. Modern Logo has not changed too much from the basic concepts before the first turtle. The first turtle was a tethered floor roamer, not radio-controlled or wireless. Later, BBN developed a turtle named "Irving" that had touch sensors and could move forwards, backwards, rotate, and ding its bell. The earliest year-long school users of Logo were in 1968-69 at Muzzey Jr High, Lexington, Massachusetts. The virtual and physical turtles were first used by fifth graders at the Bridge School in Lexington, MA in 1970-71.

Implementations As of February 2007 there were over 170 implementations and dialects of Logo, each with its own strengths. (Most of those 170 are no longer in wide use, but many are still under active development.)

As yet there is no single agreed-upon Logo language definition or standard, though there is a broad consensus on core aspects of the language. There are substantial differences between the many dialects of Logo. The situation is confused by the regular appearance of turtle graphics programs that mistakenly call themselves "Logo".

The most broadly used and prevalent early implementation of Logo was Apple Logo, developed by LCSI for the Apple II computer and popular in the 1980s.

The closest thing to a de facto Logo standard today is UCBLogo, also known as Berkeley Logo. It is free and cross-platform. UCBLogo has only a rudimentary graphical user interface, so several projects exist that provide a better interface. MSWLogo (and its successor FMSLogo), for Windows, are commonly used in schools in the United Kingdom.

Commercial Logos that are still widely used in schools include MicroWorlds Logo and Imagine Logo.

Some modern derivatives of Logo allow thousands of independently moving turtles. There are two popular implementations: StarLogo and NetLogo. They allow for the exploration of emergence and come with many experiments in social studies, biology, physics, and other areas.

Most Logos are 2D, but the Elica interpreter is notable for supporting 3D graphics. Most Logo implementations are interpreted, but some compilers have been built, including the Lhogho compiler, by the same author as Elica.

Although most often used for graphics, Logo can also control robots. It was interfaced with Lego, although Lego decided later to use another language in the commercial LEGO Mindstorms products. The Mindstorms GUI interface is based on LabVIEW by National Instruments. An interface also exists for Cricket robots.

Influence Logo was a primary influence on the Smalltalk programming language. It is also the main influence on the Etoys (programming language) educational programming environment and language, which is essentially a Logo written in Squeak (a variant of Smalltalk).

Programming The idea is that a turtle with a pen strapped to it can be instructed to do simple things like move forward 100 spaces or turn around. From these building blocks you can build more complex shapes like squares, triangles, circles--using these to draw houses or sailboats.

The turtle moves with commands that are relative to its own position, "LEFT 90" meant rotate left by 90 degrees. A student could understand (and predict and reason about) the turtle's motion by imagining what they would do if they were the turtle. Papert called this "body syntonic" reasoning.

The idea of turtle graphics is also useful for example in Lindenmayer system for generating fractals.

Turtle geometry and programming Logo's best-known feature is the "turtle", which is an on-screen cursor (derived originally from a robot of the same name) which can be given movement and drawing instructions, and is used to programmatically produce line graphics. It is traditionally and most often represented pictorially either as a triangle or a turtle icon (though it can be represented by any icon).

Turtle graphics were added to the Logo language by Seymour Papert in the late 60s to support Papert's version of the turtle (robot), a simple robot controlled from the user's workstation that is designed to carry out the drawing functions assigned to it using a small retractable pen set into or attached to the robot's body. Turtle geometry works somewhat differently from (x,y) addressed Cartesian geometry, being primarily Vector (spatial)-based (i.e. relative direction and distance from a starting point) in comparison to coordinate-addressed systems such as PostScript. As a practical matter, the use of turtle geometry instead of a more traditional model mimics the actual movement logic of the turtle robot.

The following are examples of turtle code. While seemingly very simple, turtles can be given groups of instructions, essentially creating libraries of more complex commands. In practice short forms are used. For example, "LEFT 90" is written "LT 90". Key words are usually written in upper case for beginners, but more advanced texts use lower case.

Example 1: a square FORWARD 100 LEFT 90 FORWARD 100 LEFT 90 FORWARD 100 LEFT 90 FORWARD 100 LEFT 90

This draws a square with sides 100 units long.

Example 2: a triangle The commands may be written on one line, or more. In this example we'll use the short form for FORWARD and RIGHT, which are FD and RT respectively.

FD 100 RT 120 FD 100 RT 120 FD 100 RT 120

Example 3: dotted line The turtle's pen can be lifted and lowered, thus drawing a rudimentary dotted line. Anything written after the ; (semicolon) is ignored, allowing the coder to insert comments.



FD 20 ;(drawing a line and moving) PENUP ;(now we've lifted the pen so it won't draw anything even if we do move) FD 20 ;(not drawing but moving) PENDOWN ;(now we've lowered the pen so it draws a line wherever the turtle moves) FD 20 ;(drawing a line and moving) PENUP FD 20 ;(etc...) PENDOWN FD 20


Example 4: loops You could also use loop (repeat) commands. This would draw the exact same box as in the first example:

REPEAT 4 FD 100 LEFT 90

Which executes the command "FD 100 LEFT 90" four times.An approximation of a circle can be constructed easily with 360 small rotations and a step forward: REPEAT 360 1 RIGHT 1.

Example 5: new words You can teach the turtle new words, i.e. groups of instructions, or procedures. This can be done from the Logo prompt or an Editor, which is invoked by EDALL in many Logo dialects. Here we define the word CHAIR.



EDALL

TO CHAIR REPEAT 4 FD 100 RT 90 FD 200 END


Once one is finished with the editor, it must be exited. The new word is saved into the available vocabulary, but the definition will be lost once the Logo interpreter is stopped. In this case, any time CHAIR is entered, "REPEAT 4 100 LEFT 90 FD 200" will be executed. CHAIR can be used as a command; for example, REPEAT 4 would compound the CHAIR operation four times.

Example 6: erasing (in the UCBLogo dialect) The turtle can erase a line, using the command PENERASE (PE). The pen can be restored with the command PENPAINT (PPT).

EDALL ;(to enter the editor mode, then the actual procedure)

TO ERASECHAIR PE BK 200 REPEAT 4 FD 100 RT 90 PPT END

CS CHAIR WAIT 200 ERASECHAIR This example introduces two new instructions, which are best taught by running them through a Logo interpreter and observing the result. This typifies the general spirit of Logo.

Example 7: parameters: giving the word changeable information Logo can pass extra information to its words, and return information. We must tell the word to expect something and give it a name. Notice the use of the colon. We are passing 'by value' and the colon is pronounced as 'the value of'. When the procedure is run with a command like CHAIR 200, the size takes the value 200 so we go 'FD the value of 200'.

EDALL ;(to enter the editor mode, then the actual procedure)

TO CHAIR :thesize REPEAT 4 FD :thesize RT 90 FD :thesize FD :thesize END Try CS REPEAT 9 CHAIR 50 RT 20 CHAIR 100 WAIT 50 RT 20




If you do need help, type HELP, or HELP "HOME (note the single quote mark.)




Other uses of the turtle Some Logo implementations, particularly those that allow the use of concurrency and multiple turtles, support collision detection and allow the user to redefine the appearance of the turtle cursor, essentially allowing the Logo turtles to function as Sprite (computer graphics)s.

Turtle geometry is also sometimes used in environments other than Logo as an alternative to a strictly coordinate-addressed graphics system.



The language Logo is generally known as an interpreted language, although recently there have been developed compiled Logo dialects - like Lhogho or Liogo. Logo is not case dependent, but retains the case used for formatting. It is written in lines. It is a compromise between a sequential programming language with block structures, and a functional programming language. There is no 'standard' LOGO, but UCBLogo is highly regarded. It is a teaching language but its list handling facilities make it remarkably useful for producing useful scripts.

Functions and procedures Each line is made up of "function calls", or subroutines in programming terminology, of which there are two types:



A command is similar to a Pascal (programming language) procedure, and an operation is similar to a Pascal function. (See also: command-query separation, where a "query" is an "operation" in Logo). A special subset of operations, called Predicate (computer programming)s, which just output the word true or false, are conventionally written with a final p. Examples include emptyp, wordp, and listp.



Mathematics in Logo uses prefix notation, like: sum :x :y, product :x :y, difference :x :y, quotient :x :y. Infix is also available.

help "keyword ;(will bring up a full description of the expression).

Logo allows for recursion, the process where a procedure calls itself.

Example 8: A spiral drawn using recursion to spiral :size if :size > 30 stop ; an exit condition fd :size rt 15 ; many lines of action spiral :size *1.02 ; the tailend recursive call end

spiral 10


Data There are three datatypes in UCBLogo,



A number is a special case of word.

There is no static typing. The interpreter detects the datatype by context.

There are two important symbols



This is an extremely useful symbol that keeps reminding students that a variable is really some 'place' in memory.



A number is a special case of self evaluation- it really could be written with a quote 2 is really "2

Variable assignment (computer science) (eg. x := y + 3) is handled in Logo with the make command: make "x sum :y 3 or make "x sum :y "3 make takes 2 parameters, the second of which here is sum :y "3. sum takes two 'parameters' and is an 'operation', thus the calculation is possible. "3 evaluates to 3, and :y takes the contents of the thing called y, these are summed giving a number.

The effect of make is to place the result into the first parameter. From a programmatical perspective, the first argument to make is passed "by reference", while the second is passed "by value".

Scoping Variables don't have to be declared before use. Their scope is then global.A variable may be declared local, then its scope is limited to that procedure and its subprocedures (a.k.a. dynamic scope (programming)). Calling a 'procedure' with 'inputs', creates 'local variables' which hold the contents of the parameters.

Lists Logo inherits lists from Lisp (programming language), and they are its primary method of storing "vectors". Arrays are also provided.



Example 9: using list primitives to extract the first five members of a list One way would be to use iteration.

to firstfive :alist ifelse lessp count :alist 6 op :alist make "olist repeat 5 make "olist lput first :alist :olist make "alist bf :alist output :olist end show firstfive 1 2 3 4 5 6 7 8 9 1 2 3 4 5 foreach firstfive 1 2 3 4 5 6 7 8 9 show 10 - ? 9 8 7 6 5 Another, more elegant way would be to firstn :num :list if :num = 0 output output fput (first :list) (firstn :num-1 butfirst :list) end to firstfive :list output firstn 5 :list end This method uses recursion, and is an example of a 'functional' rather than an 'imperative' programming approach. And a more general way would be to tail :num :alist if or not numberp :num not listp :alist print [Error: Bad argument(s) stop] if not equalp 0 :num - int :num make "num int :num if :num=0 output if equalp count :alist abs :num op :alist if lessp count :alist abs :num output :alist if :num>0 output tail.left :num :alist if :num 4 ] the quick brown fox jumps over the lazy dog quick brown jumps show foreach 1 2 3 4 5 ? * 10 10 20 30 40 50 RUN list of commands ;run a list of commands (or programs) from in a program. ===Property lists=== A property list is a special list where the odd number items are property names, and the even are property values. There are three commands to process property list. pprop :listname :name :value ;to add a new pair to the list remprop :listname :name :value ;to remove a pair to the list show gprop :listname :name ;to get the matching value from the list ===I/O Commands=== Text may be written to the command window (output stream) using print, show and to the graphics window using label The standard commands are readlist readword readchar with the normal input stream being the keyboard. In Unix tradition the input stream can be changed, so input can come from a disk file. Similarly, output can be redirected. openread filename setreadfilename setreadpos nn readchar setread close filename. There are equivalent commands to change the output stream, openwrite, openappend, setwrite, setwritepos nn. dribble filename Creates a transcript of everything that is typed in or outputted to the command window. nodribble This turns it off.

I/O commands can be applied to generate text to resemble a known bitmap, also seen in [ASCII art conversion programs. An example of this, a set of crosses resembling the [Mandelbrot set. ===Graphics=== Turtle graphics is a powerful method of introducing thinking but LOGO also has a few useful [Cartesian coordinate system commands home ;returns the turtle to (0,0) setx xx sety yy ; sends the turtle, still drawing to (xx,yy) seth nn ; sets the turtle on a heading or compass bearing of (nn) ====Example 10: calculating and drawing a [sundial for a given latitude==== This is a typical garden dial. The graphic can be printed and transferred to wood or brass to make an accurate garden timepiece. to dial cs show Type in your latitude as a whole number make "latitude readword ;uses keyboard input for i 0 6 1[ make "ang arctan product sin :latitude tan product :i 15 ;the calculation rt :ang fd 200 bk 200 lt :ang ;draw the morning line lt :ang fd 200 bk 200 rt :ang ;use symmetry to draw the afternoon line ] pu setx -300 sety -300 seth 90 pd ;send the turtle to the bottom fd 300 seth 270 rt 90 - :latitude fd 300 ;draw the [style or [gnomon pu home pd ;tidy it up end A sundial plate must be adjusted by latitude using the formulax= arctan( sin(latitude)*tan(HourDiff * 15) ) The Gnomon Angle = latitude.

This dial above is set for 38N, the latitude of Berkeley, California. A small correction should also be made for longitude.

MSWLogo extensions MSWLogo supports multiple turtles, and 3D Graphics. MSWLogo allows input from COM ports and LPT ports and also 'hardware' ports. MSWLogo also supports a windows interface thus I/O is available through this GUI- and keyboard and mouse events can trigger interrupts.

GIF animations Simple GIF animations may also be produced on MSWlogo version 6.5 with the "gifsave" command. An example of the result of this - an animation of a sabot separating from its shell - is given :Image:LogoSabot.gif. Another example, of an oscillating Polar coordinate system#polar rose, is given :Image:LogoExample.gif. Below is an example of code to generate a simple animation.to squareani :number setactivearea -5 -5 105 105 ;we do not want to save the entire screen local "col setpensize 3 3 ;make it a noticeable square make "append "false ;signify that we want to start a new animation repeat :number [ cs make "col 255*(repcount-1)/(:number-1) setpc (list :col :col :col) ;change the square's color repeat 4 [ ; fd 100 rt 90 ;draw the square ] ; (gifsave "squareani.gif 5 :append 0) ;save to squareani.gif make "append "true ;from now on, we want to keep adding frames to squareani.gif ] end Thus, with a :number variable of 15 frames, the result is given below, along with a slightly more complex example (note that this gifsave feature does not yield the same quality color gradients as Logo would save in bitmap form):{| class="wikitable"|-|||-|A square fading
from black to white
in 8 bits per pixel
(default for gifsave).||}

Hello world program TO HELLO PRINT Hello, world! END

HELLO

Bibliography

External links

{{Infobox programming language|name = Logo|logo = |paradigm = functional programming, educational programming language|year = 1967 & [Seymour Papert|implementations = [UCBLogo, many others]|influenced = Smalltalk, Etoys (programming language)-->

The Logo programming language is a functional programming computer programming programming language. It is an easier to read adaptation and dialect of the Lisp (programming language) language; some have called it Lisp without the S-expression. It was created for educational use, more so for Constructivism (learning theory) teaching, by Daniel G. Bobrow, Wally Feurzeig and Seymour Papert. Today, it is known mainly for its "turtle graphics", but it also has significant facilities for handling lists, files, and I/O. Logo can be used to teach most computer science concepts, as UC Berkeley Lecturer Brian Harvey (Lecturer) does in his "Computer Science Logo Style" trilogy.

History Logo was created in 1967 at Bolt, Beranek and Newman (BBN), a Cambridge, Massachusetts research firm, by Wally Feurzeig and Seymour Papert. Its intellectual roots are in artificial intelligence, mathematical logic and developmental psychology. The first four years of Logo research, development and teaching work was done at BBN. The first implementation of Logo, called "ghost", was written in LISP on an SDS 950. The goal was to create a "mathland" where kids could play with words and sentences. Modeled on LISP, the design goals of Logo included accessible power and informative error messages. The use of virtual Turtles (robot) allowed for immediate visual feedback and debugging.The first working turtle was created at MIT in 1969. A display turtle preceded the physical floor turtle. Modern Logo has not changed too much from the basic concepts before the first turtle. The first turtle was a tethered floor roamer, not radio-controlled or wireless. Later, BBN developed a turtle named "Irving" that had touch sensors and could move forwards, backwards, rotate, and ding its bell. The earliest year-long school users of Logo were in 1968-69 at Muzzey Jr High, Lexington, Massachusetts. The virtual and physical turtles were first used by fifth graders at the Bridge School in Lexington, MA in 1970-71.

Implementations As of February 2007 there were over 170 implementations and dialects of Logo, each with its own strengths. (Most of those 170 are no longer in wide use, but many are still under active development.)

As yet there is no single agreed-upon Logo language definition or standard, though there is a broad consensus on core aspects of the language. There are substantial differences between the many dialects of Logo. The situation is confused by the regular appearance of turtle graphics programs that mistakenly call themselves "Logo".

The most broadly used and prevalent early implementation of Logo was Apple Logo, developed by LCSI for the Apple II computer and popular in the 1980s.

The closest thing to a de facto Logo standard today is UCBLogo, also known as Berkeley Logo. It is free and cross-platform. UCBLogo has only a rudimentary graphical user interface, so several projects exist that provide a better interface. MSWLogo (and its successor FMSLogo), for Windows, are commonly used in schools in the United Kingdom.

Commercial Logos that are still widely used in schools include MicroWorlds Logo and Imagine Logo.

Some modern derivatives of Logo allow thousands of independently moving turtles. There are two popular implementations: StarLogo and NetLogo. They allow for the exploration of emergence and come with many experiments in social studies, biology, physics, and other areas.

Most Logos are 2D, but the Elica interpreter is notable for supporting 3D graphics. Most Logo implementations are interpreted, but some compilers have been built, including the Lhogho compiler, by the same author as Elica.

Although most often used for graphics, Logo can also control robots. It was interfaced with Lego, although Lego decided later to use another language in the commercial LEGO Mindstorms products. The Mindstorms GUI interface is based on LabVIEW by National Instruments. An interface also exists for Cricket robots.

Influence Logo was a primary influence on the Smalltalk programming language. It is also the main influence on the Etoys (programming language) educational programming environment and language, which is essentially a Logo written in Squeak (a variant of Smalltalk).

Programming The idea is that a turtle with a pen strapped to it can be instructed to do simple things like move forward 100 spaces or turn around. From these building blocks you can build more complex shapes like squares, triangles, circles--using these to draw houses or sailboats.

The turtle moves with commands that are relative to its own position, "LEFT 90" meant rotate left by 90 degrees. A student could understand (and predict and reason about) the turtle's motion by imagining what they would do if they were the turtle. Papert called this "body syntonic" reasoning.

The idea of turtle graphics is also useful for example in Lindenmayer system for generating fractals.

Turtle geometry and programming Logo's best-known feature is the "turtle", which is an on-screen cursor (derived originally from a robot of the same name) which can be given movement and drawing instructions, and is used to programmatically produce line graphics. It is traditionally and most often represented pictorially either as a triangle or a turtle icon (though it can be represented by any icon).

Turtle graphics were added to the Logo language by Seymour Papert in the late 60s to support Papert's version of the turtle (robot), a simple robot controlled from the user's workstation that is designed to carry out the drawing functions assigned to it using a small retractable pen set into or attached to the robot's body. Turtle geometry works somewhat differently from (x,y) addressed Cartesian geometry, being primarily Vector (spatial)-based (i.e. relative direction and distance from a starting point) in comparison to coordinate-addressed systems such as PostScript. As a practical matter, the use of turtle geometry instead of a more traditional model mimics the actual movement logic of the turtle robot.

The following are examples of turtle code. While seemingly very simple, turtles can be given groups of instructions, essentially creating libraries of more complex commands. In practice short forms are used. For example, "LEFT 90" is written "LT 90". Key words are usually written in upper case for beginners, but more advanced texts use lower case.

Example 1: a square FORWARD 100 LEFT 90 FORWARD 100 LEFT 90 FORWARD 100 LEFT 90 FORWARD 100 LEFT 90

This draws a square with sides 100 units long.

Example 2: a triangle The commands may be written on one line, or more. In this example we'll use the short form for FORWARD and RIGHT, which are FD and RT respectively.

FD 100 RT 120 FD 100 RT 120 FD 100 RT 120

Example 3: dotted line The turtle's pen can be lifted and lowered, thus drawing a rudimentary dotted line. Anything written after the ; (semicolon) is ignored, allowing the coder to insert comments.



FD 20 ;(drawing a line and moving) PENUP ;(now we've lifted the pen so it won't draw anything even if we do move) FD 20 ;(not drawing but moving) PENDOWN ;(now we've lowered the pen so it draws a line wherever the turtle moves) FD 20 ;(drawing a line and moving) PENUP FD 20 ;(etc...) PENDOWN FD 20


Example 4: loops You could also use loop (repeat) commands. This would draw the exact same box as in the first example:

REPEAT 4 FD 100 LEFT 90

Which executes the command "FD 100 LEFT 90" four times.An approximation of a circle can be constructed easily with 360 small rotations and a step forward: REPEAT 360 1 RIGHT 1.

Example 5: new words You can teach the turtle new words, i.e. groups of instructions, or procedures. This can be done from the Logo prompt or an Editor, which is invoked by EDALL in many Logo dialects. Here we define the word CHAIR.



EDALL

TO CHAIR REPEAT 4 FD 100 RT 90 FD 200 END


Once one is finished with the editor, it must be exited. The new word is saved into the available vocabulary, but the definition will be lost once the Logo interpreter is stopped. In this case, any time CHAIR is entered, "REPEAT 4 100 LEFT 90 FD 200" will be executed. CHAIR can be used as a command; for example, REPEAT 4 would compound the CHAIR operation four times.

Example 6: erasing (in the UCBLogo dialect) The turtle can erase a line, using the command PENERASE (PE). The pen can be restored with the command PENPAINT (PPT).

EDALL ;(to enter the editor mode, then the actual procedure)

TO ERASECHAIR PE BK 200 REPEAT 4 FD 100 RT 90 PPT END

CS CHAIR WAIT 200 ERASECHAIR This example introduces two new instructions, which are best taught by running them through a Logo interpreter and observing the result. This typifies the general spirit of Logo.

Example 7: parameters: giving the word changeable information Logo can pass extra information to its words, and return information. We must tell the word to expect something and give it a name. Notice the use of the colon. We are passing 'by value' and the colon is pronounced as 'the value of'. When the procedure is run with a command like CHAIR 200, the size takes the value 200 so we go 'FD the value of 200'.

EDALL ;(to enter the editor mode, then the actual procedure)

TO CHAIR :thesize REPEAT 4 FD :thesize RT 90 FD :thesize FD :thesize END Try CS REPEAT 9 CHAIR 50 RT 20 CHAIR 100 WAIT 50 RT 20




If you do need help, type HELP, or HELP "HOME (note the single quote mark.)




Other uses of the turtle Some Logo implementations, particularly those that allow the use of concurrency and multiple turtles, support collision detection and allow the user to redefine the appearance of the turtle cursor, essentially allowing the Logo turtles to function as Sprite (computer graphics)s.

Turtle geometry is also sometimes used in environments other than Logo as an alternative to a strictly coordinate-addressed graphics system.



The language Logo is generally known as an interpreted language, although recently there have been developed compiled Logo dialects - like Lhogho or Liogo. Logo is not case dependent, but retains the case used for formatting. It is written in lines. It is a compromise between a sequential programming language with block structures, and a functional programming language. There is no 'standard' LOGO, but UCBLogo is highly regarded. It is a teaching language but its list handling facilities make it remarkably useful for producing useful scripts.

Functions and procedures Each line is made up of "function calls", or subroutines in programming terminology, of which there are two types:



A command is similar to a Pascal (programming language) procedure, and an operation is similar to a Pascal function. (See also: command-query separation, where a "query" is an "operation" in Logo). A special subset of operations, called Predicate (computer programming)s, which just output the word true or false, are conventionally written with a final p. Examples include emptyp, wordp, and listp.



Mathematics in Logo uses prefix notation, like: sum :x :y, product :x :y, difference :x :y, quotient :x :y. Infix is also available.

help "keyword ;(will bring up a full description of the expression).

Logo allows for recursion, the process where a procedure calls itself.

Example 8: A spiral drawn using recursion to spiral :size if :size > 30 stop ; an exit condition fd :size rt 15 ; many lines of action spiral :size *1.02 ; the tailend recursive call end

spiral 10


Data There are three datatypes in UCBLogo,



A number is a special case of word.

There is no static typing. The interpreter detects the datatype by context.

There are two important symbols



This is an extremely useful symbol that keeps reminding students that a variable is really some 'place' in memory.



A number is a special case of self evaluation- it really could be written with a quote 2 is really "2

Variable assignment (computer science) (eg. x := y + 3) is handled in Logo with the make command: make "x sum :y 3 or make "x sum :y "3 make takes 2 parameters, the second of which here is sum :y "3. sum takes two 'parameters' and is an 'operation', thus the calculation is possible. "3 evaluates to 3, and :y takes the contents of the thing called y, these are summed giving a number.

The effect of make is to place the result into the first parameter. From a programmatical perspective, the first argument to make is passed "by reference", while the second is passed "by value".

Scoping Variables don't have to be declared before use. Their scope is then global.A variable may be declared local, then its scope is limited to that procedure and its subprocedures (a.k.a. dynamic scope (programming)). Calling a 'procedure' with 'inputs', creates 'local variables' which hold the contents of the parameters.

Lists Logo inherits lists from Lisp (programming language), and they are its primary method of storing "vectors". Arrays are also provided.



Example 9: using list primitives to extract the first five members of a list One way would be to use iteration.

to firstfive :alist ifelse lessp count :alist 6 op :alist make "olist repeat 5 make "olist lput first :alist :olist make "alist bf :alist output :olist end show firstfive 1 2 3 4 5 6 7 8 9 1 2 3 4 5 foreach firstfive 1 2 3 4 5 6 7 8 9 show 10 - ? 9 8 7 6 5 Another, more elegant way would be to firstn :num :list if :num = 0 output output fput (first :list) (firstn :num-1 butfirst :list) end to firstfive :list output firstn 5 :list end This method uses recursion, and is an example of a 'functional' rather than an 'imperative' programming approach. And a more general way would be to tail :num :alist if or not numberp :num not listp :alist print [Error: Bad argument(s) stop] if not equalp 0 :num - int :num make "num int :num if :num=0 output if equalp count :alist abs :num op :alist if lessp count :alist abs :num output :alist if :num>0 output tail.left :num :alist if :num 4 ] the quick brown fox jumps over the lazy dog quick brown jumps show foreach 1 2 3 4 5 ? * 10 10 20 30 40 50 RUN list of commands ;run a list of commands (or programs) from in a program. ===Property lists=== A property list is a special list where the odd number items are property names, and the even are property values. There are three commands to process property list. pprop :listname :name :value ;to add a new pair to the list remprop :listname :name :value ;to remove a pair to the list show gprop :listname :name ;to get the matching value from the list ===I/O Commands=== Text may be written to the command window (output stream) using print, show and to the graphics window using label The standard commands are readlist readword readchar with the normal input stream being the keyboard. In Unix tradition the input stream can be changed, so input can come from a disk file. Similarly, output can be redirected. openread filename setreadfilename setreadpos nn readchar setread close filename. There are equivalent commands to change the output stream, openwrite, openappend, setwrite, setwritepos nn. dribble filename Creates a transcript of everything that is typed in or outputted to the command window. nodribble This turns it off.

I/O commands can be applied to generate text to resemble a known bitmap, also seen in [ASCII art conversion programs. An example of this, a set of crosses resembling the [Mandelbrot set. ===Graphics=== Turtle graphics is a powerful method of introducing thinking but LOGO also has a few useful [Cartesian coordinate system commands home ;returns the turtle to (0,0) setx xx sety yy ; sends the turtle, still drawing to (xx,yy) seth nn ; sets the turtle on a heading or compass bearing of (nn) ====Example 10: calculating and drawing a [sundial for a given latitude==== This is a typical garden dial. The graphic can be printed and transferred to wood or brass to make an accurate garden timepiece. to dial cs show Type in your latitude as a whole number make "latitude readword ;uses keyboard input for i 0 6 1[ make "ang arctan product sin :latitude tan product :i 15 ;the calculation rt :ang fd 200 bk 200 lt :ang ;draw the morning line lt :ang fd 200 bk 200 rt :ang ;use symmetry to draw the afternoon line ] pu setx -300 sety -300 seth 90 pd ;send the turtle to the bottom fd 300 seth 270 rt 90 - :latitude fd 300 ;draw the [style or [gnomon pu home pd ;tidy it up end A sundial plate must be adjusted by latitude using the formulax= arctan( sin(latitude)*tan(HourDiff * 15) ) The Gnomon Angle = latitude.

This dial above is set for 38N, the latitude of Berkeley, California. A small correction should also be made for longitude.

MSWLogo extensions MSWLogo supports multiple turtles, and 3D Graphics. MSWLogo allows input from COM ports and LPT ports and also 'hardware' ports. MSWLogo also supports a windows interface thus I/O is available through this GUI- and keyboard and mouse events can trigger interrupts.

GIF animations Simple GIF animations may also be produced on MSWlogo version 6.5 with the "gifsave" command. An example of the result of this - an animation of a sabot separating from its shell - is given :Image:LogoSabot.gif. Another example, of an oscillating Polar coordinate system#polar rose, is given :Image:LogoExample.gif. Below is an example of code to generate a simple animation.to squareani :number setactivearea -5 -5 105 105 ;we do not want to save the entire screen local "col setpensize 3 3 ;make it a noticeable square make "append "false ;signify that we want to start a new animation repeat :number [ cs make "col 255*(repcount-1)/(:number-1) setpc (list :col :col :col) ;change the square's color repeat 4 [ ; fd 100 rt 90 ;draw the square ] ; (gifsave "squareani.gif 5 :append 0) ;save to squareani.gif make "append "true ;from now on, we want to keep adding frames to squareani.gif ] end Thus, with a :number variable of 15 frames, the result is given below, along with a slightly more complex example (note that this gifsave feature does not yield the same quality color gradients as Logo would save in bitmap form):{| class="wikitable"|-|||-|A square fading
from black to white
in 8 bits per pixel
(default for gifsave).||}

Hello world program TO HELLO PRINT Hello, world! END

HELLO

Bibliography

External links



Logo (programming language) - Wikipedia, the free encyclopedia
Logo is a computer programming language used for functional programming. It is an easier-to-read adaptation and dialect of the Lisp language; some have called it Lisp without the ...

The Logo Programming Language
ADD DESCRIPTION OF PAGE ... The Logo Programming Language, a dialect of Lisp, was designed as a tool for learning.

Logo Foundation
A nonprofit educational organization devoted to informing people about Logo and supporting them in their use of Logo-based software and learning environments. A list of Logo ...

The Logo Programming Language
History Logo was developed by a team from MIT, Logo was originally designed to introduce children to programming concepts, to develop better thinking skills that could be ...

ACS Home Page
ACSLogo is a Logo Interpreter for Mac OS X. Logo is a popular language used to teach simple programming by guiding the progress of a 'turtle' which moves around a graphics screen.

Category:Logo (programming language) - Wikimedia Commons
Media in category "Logo (programming language)" The following 8 files are in this category, out of 8 total.

Learning LOGO
In the fall of 1995 I started teaching my son's second grade class how to program using the LOGO programming language. Logo is wonderful because for very little work you can get ...

MSWLogo, An Educational programming language
Softronics Inc., an Educational Software Company ... MSW Logo Kits (Current version is 6.5b, released December 19, 2002) Release Notes:

Logo (programming language) definition of Logo (programming language ...
All content on this website, including dictionary, thesaurus, literature, geography, and other reference data is for informational purposes only.

PC AI - Logo Programming Language
Overview: Devised in the late 60s by Papert and his colleagues at MIT as an educational aid for children, Logo is a subset of LISP and can be used ...

 

Logo Programming Language



 
Copyright © 2008 Hintcenter.com - All rights reserved.
Home | Terms of Use | Privacy Policy
All Trademarks belong to their repective owners. Many aspects of this page are used under
commercial commons license from Yahoo!